<%--
    Document   : admin
    Created on : 02-jun-2011, 17:24:24
    Author     : Jesus
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<%
    if(request.getParameter("submit")!=null && request.getParameter("submit").equals("Guardar") && request.getAttribute("insertado")==null){
        RequestDispatcher rd = request.getRequestDispatcher("SAlta?id=Usuario");
        rd.forward(request, response);
    }
%>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Admin Gestión</title>
        <link type="text/css" rel="stylesheet" href="estilo/pagina.css"/>
    </head>
    <body>
        <%@include file="cabecera.jsp" %>
        <%@include file="menu.jsp" %>
            <div id="contenido">
                <h2 align="center">Alta de Usuario</h2><br>
                        
                     <% if(request.getAttribute("insertado")!=null && ((Integer)request.getAttribute("insertado"))==1){ %>
                     
                     <fieldset style="background-color: lightgreen">  
                         <h2 style="color: green;" align="center">Usuario insertado correctamente</h2>  
                     </fieldset><br>

                     <% } else if(request.getAttribute("insertado")!=null && ((Integer)request.getAttribute("insertado"))==0){ %>
                     
                     <fieldset style="background-color: #ffccd5">  
                         <h2 style="color: red;" align="center">Error al insertar el Uusario</h2>  
                     </fieldset><br>
                    
                    <% } else if(request.getAttribute("insertado")!=null && ((Integer)request.getAttribute("insertado"))==2){ %>
                    
                     <fieldset style="background-color: #ffccd5">
                         <h2 style="color: red;" align="center">¡ Las claves no coinciden !</h2>  
                     </fieldset><br>
                     
                    <% }else if(request.getAttribute("insertado")!=null && ((Integer)request.getAttribute("insertado"))==3){ %>
                    
                     <fieldset style="background-color: #ffccd5">
                         <h2 style="color: red;" align="center">¡ Existen campos vacios !</h2>  
                     </fieldset><br>
                     
                    <% } else if(request.getAttribute("insertado")!=null && ((Integer)request.getAttribute("insertado"))==4){ %>
                    
                     <fieldset style="background-color: #ffccd5">
                         <h2 style="color: red;" align="center">¡ El Nombre de usuario ya existe !</h2>  
                     </fieldset><br>
                     
                    <% }request.removeAttribute("insertado"); %>
                <form action="" method="post">
                    <table>
                        <tr>
                            <td align="right">
                                <label for="nombreusr">Nombre Usuario: </label>
                            </td>
                            <td>
                                 <input type="text" name="nombreusr" value="<%= (request.getParameter("nombreusr")==null)? "" : request.getParameter("nombreusr") %>"/>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2"><br></td>
                        </tr>
                        <tr>
                            <td align="right">
                                <label for="clave1">Clave: </label>
                            </td>
                            <td>
                                <input type="password" name="clave1" value="<%= (request.getParameter("clave1")==null)? "" : request.getParameter("clave1") %>"/>
                            </td>
                        </tr>
                        <tr>
                            <td align="right">
                                <label for="clave2">*Repita la clave: </label>
                            </td>
                            <td>
                                <input type="password" name="clave2" value="<%= (request.getParameter("clave2")==null)? "" : request.getParameter("clave2") %>"/>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2"><br></td>
                        </tr>
                        <tr>
                            <td colspan="8" align="right">
                                <input type="submit" value="Guardar" name="submit"/>
                            </td>
                        </tr>
                    </table>
                </form>
            </div>
        <div id="pie">

        </div>
    </body>
</html>
